import React from "react";

type PropsType = {
  text: string;
  isCenter: boolean;
};

const QuestionParagraph: React.FC<PropsType> = ({ text, isCenter }) => {
  const style: React.CSSProperties = { padding: "10px 0" };
  const textList = text.split("\n");
  if (isCenter) style.textAlign = "center";

  return (
    <p style={style}>
      {textList.map((t, index) => (
        <span key={index}>
          {t}
          <br />
        </span>
      ))}
    </p>
  );
};

export default QuestionParagraph;
